export default {
	name: "add-group",
	data() {
		return {
			action: "add",
			colWidth: 8,
			itemWidth: 22,
			formItems: [
				{"label": "编号", "kind": "input", "prop": "id", "isEdit": false, "disabled": true},
				{"label": "名称", "kind": "input", "prop": "name", "isEdit": false, "disabled": false}
			],
			formParams: {}
		};
	},
	created() {
		this.initData(this.$route);
	},
	methods: {
		handleSave(formParams) {
			this.formParams = formParams;
			console.log(this.formParams);
		},
		handleReset() {
			this.formParams = {};
		},
		initData(route) {
			this.formParams = this.formHandler.handleParams(route);
			this.action = this.formHandler.handleAction(route);
			this.formHandler.updateEditStatus(this.action, this.formItems);
		}
	},
	watch: {
		//监听路由的变化来实现添加或切换tab
		$route(to) {
			this.initData(to);
		}
	}
};
